<html>

<head>
	<title>LTE Build Dashboard</title>
	<link rel="stylesheet" href="styles/dashboard.css" type="text/css" />
	<script src="javascript/jquery-1.4.min.js"></script>
	<script src="javascript/build.js"></script>
	<script>
		jobUrls = {
			//"http://135.251.238.250:8080/view/TLA3.0/view/TLA3.0-CALLP/job/L3CallP-COMPILE/" : "callp",
			//"http://135.251.238.250:8080/view/TLA3.0/view/TLA3.0-CALLP/job/TLA3.0_CALLP_CI_HOST_TEST/" : "host",
			"http://localhost:8080/job/test/" : "localhost build"
		};
		
		$(document).ready(function(){
			refresh();
			setInterval("refresh()", 5 * 60 * 1000);
		});
		
		refresh = function(){
			$("#statuses").empty();
			for(url in jobUrls){
				retrieveBuildStatus(url + '/lastBuild/api/json');
			}
		}
		
		retrieveBuildStatus = function(job_url){
			$.ajax({
		  	  	url: job_url + "?jsonp=parseBuildStatus",
		  	  	dataType: "jsonp",
		  	  	method: "GET"
		  	});
		}
		
		parseBuildStatus = function(build_json){
			build = new Build(build_json);
			showBuildStatus(build);
		}
		
		showBuildStatus = function(build){
			$("#statuses").append(
				"<div class='status "+ build.getStatus() +"'>" 
				+ "<a class='subject' href='" + build.getJobUrl() + "'>" + jobUrls[build.getJobUrl()] + "</a><br/>" 
				//+ "<span class='statusInWords'> by -- "+ build.getSubmitter()+ "</span></div>"
			);
		}
	</script>  
</head>
<body>
<div id="statuses">
</div>
</body>
</html>
